package com.ccsoft.atools.controller;

import com.ccsoft.atools.model.FieldConfig;
import com.ccsoft.atools.service.FieldConfigService;
import com.ccsoft.atools.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/fieldConfig")
public class FieldConfigController {

    @Autowired
    private FieldConfigService service;

    @GetMapping("/deleteByPrimaryKey/{iid}")
    public JsonResult deleteByPrimaryKey(@PathVariable Integer iid){
        return JsonResult.ok(service.deleteByPrimaryKey(iid));
    }

    @PostMapping("/insert")
    public JsonResult insert(@RequestBody FieldConfig record){
        return JsonResult.ok(service.insert(record));
    }

    @PostMapping("/insertSelective")
    public JsonResult insertSelective(@RequestBody FieldConfig record){
        return JsonResult.ok(service.insertSelective(record));
    }

    @GetMapping("/selectByPrimaryKey/{iid}")
    public JsonResult selectByPrimaryKey(@PathVariable Integer iid){
        return JsonResult.ok(service.selectByPrimaryKey(iid));
    }

    @PostMapping("/updateByPrimaryKeySelective")
    public JsonResult updateByPrimaryKeySelective(@RequestBody FieldConfig record){
        return JsonResult.ok(service.updateByPrimaryKeySelective(record));
    }

    @PostMapping("/updateByPrimaryKey")
    public JsonResult updateByPrimaryKey(@RequestBody FieldConfig record){
        return JsonResult.ok(service.updateByPrimaryKey(record));
    }

    @GetMapping("/selectAll")
    public JsonResult selectAll(){
        return JsonResult.ok(service.selectAll());
    }

    @PostMapping("/selectEqual")
    public JsonResult selectEqual(@RequestBody FieldConfig record){
        return JsonResult.ok(service.selectEqual(record));
    }

}
